Skip to content

Conversation

@andrew-anyscale
Copy link
Contributor

Adds new script push_ray_image.py for publishing Wanda-cached Ray images to Docker Hub.

Focus on this is replicating the tagging logic from ci/ray_ci/docker_container.py. Many test
cases were added to try to replicate the existing publishing cases, but it'll be good to hear
if any others would be helpful.

Topic: push-script
Signed-off-by: andrew [email protected]

@andrew-anyscale
Copy link
Contributor Author

Reviews in this chain:
#60197 [ci] Add RayImagePushContext for publishing wanda Ray images
 └#59936 feat(ci): wanda ray image builds, uploads to Dockerhub
  └#59937 Add wanda anyscale image builds for release tests

@andrew-anyscale
Copy link
Contributor Author

andrew-anyscale commented Jan 16, 2026

# head base diff date summary
0 a0e25707 545eefc9 diff Jan 15 17:41 PM 3 files changed, 643 insertions(+)
1 06d411f4 545eefc9 diff Jan 15 18:02 PM 2 files changed, 33 insertions(+), 14 deletions(-)
2 c97824d8 cb6188d5 diff Jan 16 13:28 PM 1 file changed, 4 insertions(+), 1 deletion(-)
3 dfa84607 cb6188d5 diff Jan 16 14:05 PM 1 file changed, 3 insertions(+), 2 deletions(-)

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new script push_ray_image.py and its corresponding tests test_push_ray_image.py for publishing Wanda-cached Ray images to Docker Hub. The new RayImagePushContext class encapsulates the logic for generating image tags based on various parameters like branch, commit, Ray type, Python version, platform, and architecture. The accompanying tests are comprehensive and cover a wide range of scenarios, which is excellent for ensuring the correctness of the complex tagging logic. The Bazel build rules have also been updated to include the new binary and test.

One area for improvement is the use of assert statements for input validation in assert_published_image_type. While useful for development, assert statements are removed in optimized Python builds, which could lead to unexpected behavior if these validations are critical for the script's operation in a production environment.

Comment on lines 112 to 125
assert self.python_version in PYTHON_VERSIONS_RAY_ML, invalid_python_version
assert self.platform in PLATFORMS_RAY_ML, invalid_platform
assert self.architecture in ARCHITECTURES_RAY_ML, invalid_architecture
elif self.ray_type in [RayType.RAY_LLM, RayType.RAY_LLM_EXTRA]:
assert (
self.python_version in PYTHON_VERSIONS_RAY_LLM
), invalid_python_version
assert self.platform in PLATFORMS_RAY_LLM, invalid_platform
assert self.architecture in ARCHITECTURES_RAY_LLM, invalid_architecture
else:
# ray or ray-extra
assert self.python_version in PYTHON_VERSIONS_RAY, invalid_python_version
assert self.platform in PLATFORMS_RAY, invalid_platform
assert self.architecture in ARCHITECTURES_RAY, invalid_architecture
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using assert statements for input validation that relies on external parameters (like command-line arguments or environment variables) is not robust for production code. Python's assert statements are typically compiled out when running with the -O (optimize) flag, meaning these critical checks would be skipped. It's better to explicitly raise PushRayImageError for invalid inputs to ensure consistent behavior across all environments.

        if self.ray_type in [RayType.RAY_ML, RayType.RAY_ML_EXTRA]:
            if self.python_version not in PYTHON_VERSIONS_RAY_ML:
                raise PushRayImageError(invalid_python_version)
            if self.platform not in PLATFORMS_RAY_ML:
                raise PushRayImageError(invalid_platform)
            if self.architecture not in ARCHITECTURES_RAY_ML:
                raise PushRayImageError(invalid_architecture)
        elif self.ray_type in [RayType.RAY_LLM, RayType.RAY_LLM_EXTRA]:
            if self.python_version not in PYTHON_VERSIONS_RAY_LLM:
                raise PushRayImageError(invalid_python_version)
            if self.platform not in PLATFORMS_RAY_LLM:
                raise PushRayImageError(invalid_platform)
            if self.architecture not in ARCHITECTURES_RAY_LLM:
                raise PushRayImageError(invalid_architecture)
        else:
            # ray or ray-extra
            if self.python_version not in PYTHON_VERSIONS_RAY:
                raise PushRayImageError(invalid_python_version)
            if self.platform not in PLATFORMS_RAY:
                raise PushRayImageError(invalid_platform)
            if self.architecture not in ARCHITECTURES_RAY:
                raise PushRayImageError(invalid_architecture)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement

Huh TIL. I don't believe we're running in optimized mode today, but I'll use this anyways to start building that practice

@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/push-script branch from a0e2570 to 06d411f Compare January 16, 2026 02:02
ctx = make_ctx(python_version="3.12", commit="abc123def456")
tags = ctx.destination_tags()
assert "abc123-py312-cpu" in tags
assert "build123-py312-cpu" in tags
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test does not actually test feature branch behavior

Low Severity

The test_feature_branch_non_pr test claims to test "non-PR feature branch" behavior per its name and docstring, but it uses make_ctx(python_version="3.12", commit="abc123def456") without overriding the branch parameter. The default branch in make_ctx is "master", so this test actually exercises master branch behavior instead of feature branch behavior. The test passes coincidentally because both code paths return [sha_tag, rayci_build_id], but feature branch handling is not actually being validated.

Fix in Cursor Fix in Web

@ray-gardener ray-gardener bot added the devprod label Jan 16, 2026
Copy link
Collaborator

@aslonnie aslonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

what is the future plan for the current/old pushing script/logic?

@aslonnie aslonnie self-requested a review January 16, 2026 17:52
@aslonnie
Copy link
Collaborator

lint failing?

Copy link
Collaborator

@aslonnie aslonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix lint?

Adds new script `push_ray_image.py` for publishing Wanda-cached Ray images to Docker Hub.

Focus on this is replicating the tagging logic from ci/ray_ci/docker_container.py. Many test
cases were added to try to replicate the existing publishing cases, but it'll be good to hear
if any others would be helpful.

Topic: push-script
Signed-off-by: andrew <[email protected]>
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/push-script branch from 06d411f to c97824d Compare January 16, 2026 21:28
@andrew-anyscale
Copy link
Contributor Author

Fixed lint failures

what is the future plan for the current/old pushing script/logic?

Once I've confirmed no other areas are using the current/old pushing logic, I'm planning to delete them. I believe the Wheels logic may have to stay for Windows, so anything around there will need to be carefully pruned

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/push-script branch from c97824d to dfa8460 Compare January 16, 2026 22:05
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.


logger.info(
f"Successfully pushed {ctx.ray_type.value} image with tags: {destination_tags}"
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misleading "Successfully pushed" log in dry run mode

Low Severity

The final log message states "Successfully pushed" even when dry_run=True (i.e., upload=False). In dry run mode, _copy_image only logs what would happen and returns without actually copying any images. The summary message at line 312-314 doesn't account for the dry run state, giving users incorrect feedback that images were pushed when they weren't.

Fix in Cursor Fix in Web

@aslonnie aslonnie added the go add ONLY when ready to merge, run all tests label Jan 16, 2026
@aslonnie aslonnie merged commit 93ed023 into master Jan 17, 2026
7 checks passed
@aslonnie aslonnie deleted the andrew/revup/master/push-script branch January 17, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants